home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / funny_baseball.swf / scripts / frame_72 / DoAction.as
Text File  |  2006-11-13  |  5KB  |  196 lines

  1. function Check_bat()
  2. {
  3.    if(this.player._x >= 256 && this.player._x < 261.2)
  4.    {
  5.       this.Place = 1;
  6.    }
  7.    else if(this.player._x >= 261.2 && this.player._x < 266.4)
  8.    {
  9.       this.Place = 2;
  10.    }
  11.    else if(this.player._x >= 266.4 && this.player._x < 271.6)
  12.    {
  13.       this.Place = 3;
  14.    }
  15.    else if(this.player._x >= 271.6 && this.player._x < 276.8)
  16.    {
  17.       this.Place = 4;
  18.    }
  19.    else
  20.    {
  21.       this.Place = 5;
  22.    }
  23. }
  24. function Down()
  25. {
  26.    this.onMouseDown = function()
  27.    {
  28.       if(this.Targ._currentframe == 2)
  29.       {
  30.          if(this.Follow)
  31.          {
  32.             this.Hit = true;
  33.             this.player2.FFF = true;
  34.             this.Follow = false;
  35.             this.player.play();
  36.             if(!this.bat_snd)
  37.             {
  38.                SoundObj2.start();
  39.             }
  40.          }
  41.       }
  42.    };
  43. }
  44. function Hit_Ball()
  45. {
  46.    if(this.Hit)
  47.    {
  48.       if(this.bat_hit)
  49.       {
  50.          if(this.player.hit.hitTest(this.player2.ballMC))
  51.          {
  52.             SoundObj1.start();
  53.             this.Hit = false;
  54.             if(this.Check == 1)
  55.             {
  56.                this.Ran = random(2) + 9;
  57.             }
  58.             else if(this.Check == 2)
  59.             {
  60.                this.Ran = random(2) + 16;
  61.             }
  62.             else if(this.Check == 3)
  63.             {
  64.                this.Ran = random(2) + 23;
  65.             }
  66.             else if(this.Check == 5)
  67.             {
  68.                if(this.Place == 1 || this.Place == 2)
  69.                {
  70.                   this.Ran = 15;
  71.                }
  72.                else if(this.Place == 3)
  73.                {
  74.                   this.Ran = 22;
  75.                }
  76.                else
  77.                {
  78.                   this.Ran = 29;
  79.                }
  80.             }
  81.             else
  82.             {
  83.                this.CCC = false;
  84.                this.Ran = 30 + random(3);
  85.             }
  86.             if(this.CCC)
  87.             {
  88.                if(this.Choice == 1)
  89.                {
  90.                   if(this.Place == 1 || this.Place == 2)
  91.                   {
  92.                      this.Ran = this.Ran;
  93.                   }
  94.                   else if(this.Place == 3)
  95.                   {
  96.                      this.Ran += 4;
  97.                   }
  98.                   else
  99.                   {
  100.                      this.Ran += 2;
  101.                   }
  102.                }
  103.                else if(this.Choice == 2)
  104.                {
  105.                   if(this.Place == 1)
  106.                   {
  107.                      this.Ran += 4;
  108.                   }
  109.                   else if(this.Place == 2 || this.Place == 3)
  110.                   {
  111.                      this.Ran += 2;
  112.                   }
  113.                   else
  114.                   {
  115.                      this.Ran = this.Ran;
  116.                   }
  117.                }
  118.                else if(this.Choice == 3)
  119.                {
  120.                   if(this.Place == 1 || this.Place == 2)
  121.                   {
  122.                      this.Ran = this.Ran;
  123.                   }
  124.                   else if(this.Place == 3 || this.Place == 4)
  125.                   {
  126.                      this.Ran += 2;
  127.                   }
  128.                   else
  129.                   {
  130.                      this.Ran += 4;
  131.                   }
  132.                }
  133.                else if(this.Choice == 4)
  134.                {
  135.                   if(this.Place == 1 || this.Place == 2)
  136.                   {
  137.                      this.Ran = 15;
  138.                   }
  139.                   else if(this.Place == 3)
  140.                   {
  141.                      this.Ran = 22;
  142.                   }
  143.                   else
  144.                   {
  145.                      this.Ran = 29;
  146.                   }
  147.                }
  148.             }
  149.             this.player2.ballMc.RX = this.player2.ballMC.ball.ball_in._x;
  150.             this.player2.ballMc.RY = this.player2.ballMC.ball.ball_in._y;
  151.             this.CCC = true;
  152.             trace(this.Ran);
  153.             this.player2.ballMC.gotoAndStop(this.Ran);
  154.          }
  155.       }
  156.    }
  157. }
  158. this.stop();
  159. this.step = 1;
  160. this.Follow = true;
  161. this.Hit = true;
  162. this.HIHIHI = true;
  163. this.CCC = true;
  164. this.Score = 0;
  165. this.onEnterFrame = function()
  166. {
  167.    if(this.vol == 1)
  168.    {
  169.       soundOn();
  170.       this.vol = 2;
  171.    }
  172.    if(this.vol == 0)
  173.    {
  174.       soundOff();
  175.       this.vol = 2;
  176.    }
  177.    this.txt = this.Score;
  178.    this.Targ._x = this._xmouse;
  179.    this.Targ._y = this._ymouse;
  180.    if(this.Follow)
  181.    {
  182.       this.player._x = this.Targ._x;
  183.    }
  184.    if(this.player._x < 255)
  185.    {
  186.       this.player._x = 256;
  187.    }
  188.    else if(this.player._x > 283)
  189.    {
  190.       this.player._x = 282;
  191.    }
  192.    Check_bat();
  193.    Down();
  194.    Hit_Ball();
  195. };
  196.